package conversores;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;


public class KeyLowerCaseConverter implements Converter {
	
	public Object getAsObject (FacesContext fc, UIComponent c, String valorTela) throws ConverterException {
		
		if ((valorTela == "") || (valorTela.trim().equals(""))){
			return null;
		} else 
			return valorTela.toLowerCase();
	}
	
	public String getAsString (FacesContext fc, UIComponent c, Object valor) throws ConverterException {
		if ((valor == null) || (valor.toString().trim().equals(""))){
			return "";
		} else 
			return valor.toString();
	}
	


}
